package com.lsh.oms.core.enums;

import org.springframework.util.StringUtils;

/**
 * Created by panxudong on 16/12/27.
 */
public enum EsOrderType {
    ORDER("com.lsh.oms.api.model.es.OrderHeadForEs", 1),
    SHIPPING_ORDER("com.lsh.oms.core.model.other.OrderShippingHeadWithBLOBs", 2),
    RECEIPT_ORDER("com.lsh.oms.core.model.order.OrderSignHead", 3),
    RETURN_ORDER("com.lsh.oms.core.model.order.OrderRoHead", 4);

    private String value;
    private int type;

    EsOrderType(String value, int type) {
        this.value = value;
        this.type = type;
    }

    public static EsOrderType getOrderType(String value) {
        if(!StringUtils.hasText(value)) {
            return null;
        }
        for (EsOrderType e : EsOrderType.values()) {
            if(value.equals(e.getValue())) {
                return e;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }

    public int getType() {
        return type;
    }
}
